<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>

        // //存
        // localStorage.setItem('uname','Bit')

        // //取
        // //如果key存在，则取出相应的数据，否则取值为null(表示key不存在)
        // console.log(localStorage.getItem('uname'))

        // //删
        // localStorage.removeItem('uname')

        //注意数组或对象的存储
        const obj={
            id:10001,
            name:'bit',
            age:9
        }

        //存：序列化
        localStorage.setItem('bit',JSON.stringify(obj))

        //取：反序列化
        console.log(JSON.parse(localStorage.getItem('bit')))
    </script>
</body>
</html>